#ifndef	__DEMO_TANK_BASE_H__
#define	__DEMO_TANK_BASE_H__


#include"..\..\..\include\hge.h"
#include"..\..\..\include\hgevector.h"
#include"DEMORenderComponent.h"
#include"DEMOI_InputOb.h"
#include"DEMO_Actor.h"


enum ETankState
{
	ETS_Idle,
	ETS_Moving,
	ETS_Max,
};

class DEMOTank_Base : public DEMO_Actor,implements DEMOI_InputOb /*,implements DEMOI_Actor*/
{
protected:

	//	render using
	DEMORenderComponent*	_renderComp;
	int _frameIdx;
	int	_xScreen,_yScreen;
	float _rot,_scale;
	DWORD _col;

	//	state logic variables.	//	temp use 2 frames as data, we should change to ONE anim as data.
	int _frameIdleIdx,_frameMovingIdx;	
	ETankState _curState;

	hgeVector		_speed;

protected:
	void resetRenderFrame(int frameIdxIdx,int frameMovingIdx);
	void resetSpeed( float vx,float vy);
	void resetState( ETankState targetState);
	void doMove();
	
public:
	DEMOTank_Base();
	DEMOTank_Base(char* texName,char* sprDataName);
	virtual ~DEMOTank_Base();

	void moveToUp();
	void moveToDown();
	void moveToLeft();
	void moveToRight();

	void tick(float deltaTime);						//	implement DEMOI_Actor
	void OnHeartBeat_Render();
	void OnHeartBeat_Logic();
	void OnInput(hgeInputEvent theEvent);			//	implement DEMOI_InputOb

};

#endif	//	__DEMO_TANK_BASE_H__